package com.ethink.system.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.system.api.info.SystemUserRoleInfo;
import com.ethink.system.common.entity.SystemUserRole;

/**
 * 系统用户角色表 Converter转换器
 *
 * @author default
 * @date 2022-09-27
 */
@Component
public class SystemUserRoleConverter implements Converter<SystemUserRoleInfo, SystemUserRole> {

    @Override
    public SystemUserRole convertTo(SystemUserRoleInfo info) {
        if(info == null) {
            return null;
        }
        SystemUserRole entity = new SystemUserRole ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SystemUserRoleInfo convertFrom(SystemUserRole entity) {
        if(entity == null) {
            return null;
        }
        SystemUserRoleInfo info = new SystemUserRoleInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
